<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of dataprovider
 *
 * @author HoangLinh
 */
class dataprovider {
    //put your code here
    private $connection;
    
    public static function ConnectDatabase()
    {
        $connection = mysql_connect("localhost", "root");
        if(!$connection)
            return FALSE;
        $state = mysql_select_db("social",$connection);
        if(!$state)
            return FALSE;
        return TRUE;
    }
    public static function ExecuteQuery($sql)
    {
        $connection = mysql_connect("localhost", "root","") or die("couldn't connect to localhost");
        mysql_select_db("social",$connection);
        mysql_query("set_names 'utf8'");
        $result = mysql_query($sql,$connection);
        //mysql_close($connection);
        return $result;
    }
    public static function CloseDatabase()
    {
        mysql_close($this->connection);
    }
}

?>
